package com.idreamsky.core.lib.widget;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.RadioButton;

/**
 * 类说明
 * @author William.cheng
 * @version 创建时间：2011-12-20 下午5:48:58
 */
public class NavigateButton extends RadioButton {

    public NavigateButton(Context context) {
        super(context);

    }

    public NavigateButton(Context context, AttributeSet attrs) {
        super(context, attrs);

    }

    public NavigateButton(Context context, AttributeSet attrs,
            int defStyle) {
        super(context, attrs, defStyle);

    }
    
    @Override
    public boolean performClick() {
        if (mClickCondition != null && !mClickCondition.getCondition()) {
            return false;
        }
        return super.performClick();
    }
    
    public void setClickCondition(ClickCondition clickCondition) {
        mClickCondition = clickCondition;
    }

    private ClickCondition mClickCondition;
    public interface ClickCondition {
        /**
         * @author William.cheng
         * @version 创建时间：2011-12-20 下午5:52:26
         * @return 返回true，执行点击事件,否则不执行点击事件
         */
        boolean getCondition();
    }
}
